package tr.edu.yildiz.ce.dap.appagent.command.prompt;

import javax.swing.text.html.HTMLDocument.HTMLReader.PreAction;

import tr.edu.yildiz.ce.dap.appagent.command.deployment.base.AbstractAgentCommand;
import tr.edu.yildiz.ce.dap.appagent.exception.BasicAgentException;
import tr.edu.yildiz.ce.dap.appagent.model.DapMessage;
import tr.edu.yildiz.ce.dap.appagent.process.base.AbstractProcess;

public abstract class BasicPromptCommand {
	
	AbstractProcess process;
	
	public BasicPromptCommand(AbstractProcess process) {
		this.process = process;
	}
	
	protected abstract AbstractAgentCommand prepareAgentCommand(AbstractProcess process,String commandStr) throws BasicAgentException;
	
	protected abstract void processResponse(DapMessage response);
	
	public void call(AbstractProcess process ,String commandStr) throws BasicAgentException{
		AbstractAgentCommand agentCommand = prepareAgentCommand(process,commandStr);
		DapMessage response = agentCommand.execute(new DapMessage());
		processResponse(response);
	}
	
	
}
